package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.view.ViewStub;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import com.huawei.appmarket.service.store.awk.bean.SubstanceListCardBean;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import o.cgz;
import o.ewm.j;

public class SubstanceListCard extends BaseHorizontalItemCard {
    private Map<Integer, ViewStub> ʻ = new HashMap();
    private Map<Integer, AbstractSubstanceListItemCard> ˋ = new HashMap();

    public SubstanceListCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ViewStub viewStub = (ViewStub) view.findViewById(j.ʾᐨ);
        SubstanceListCardHeadItem substanceListCardHeadItem = new SubstanceListCardHeadItem(view.getContext());
        ViewStub viewStub2 = (ViewStub) view.findViewById(j.ʾᐧ);
        SubstanceListCardVideoItem substanceListCardVideoItem = new SubstanceListCardVideoItem(view.getContext());
        ViewStub viewStub3 = (ViewStub) view.findViewById(j.ˌﾟ);
        SubstanceListCardImmersiveItem substanceListCardImmersiveItem = new SubstanceListCardImmersiveItem(view.getContext());
        ViewStub viewStub4 = (ViewStub) view.findViewById(j.ʾꓸ);
        SubstanceListCardDlItem substanceListCardDlItem = new SubstanceListCardDlItem(view.getContext());
        ViewStub viewStub5 = (ViewStub) view.findViewById(j.ˌﾞ);
        SubstanceListCardAudioItem substanceListCardAudioItem = new SubstanceListCardAudioItem(view.getContext());
        ViewStub viewStub6 = (ViewStub) view.findViewById(j.ˌﹳ);
        SubstanceListCardImmersiveItem substanceListCardImmersiveItem2 = new SubstanceListCardImmersiveItem(view.getContext());
        this.ˋ.put(Integer.valueOf(2), substanceListCardHeadItem);
        this.ˋ.put(Integer.valueOf(3), substanceListCardVideoItem);
        this.ˋ.put(Integer.valueOf(4), substanceListCardDlItem);
        this.ˋ.put(Integer.valueOf(5), substanceListCardImmersiveItem);
        this.ˋ.put(Integer.valueOf(7), substanceListCardAudioItem);
        this.ˋ.put(Integer.valueOf(8), substanceListCardImmersiveItem2);
        this.ʻ.put(Integer.valueOf(2), viewStub);
        this.ʻ.put(Integer.valueOf(3), viewStub2);
        this.ʻ.put(Integer.valueOf(4), viewStub4);
        this.ʻ.put(Integer.valueOf(5), viewStub3);
        this.ʻ.put(Integer.valueOf(7), viewStub5);
        this.ʻ.put(Integer.valueOf(8), viewStub6);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof SubstanceListCardBean) {
            SubstanceListCardBean substanceListCardBean = (SubstanceListCardBean) cardBean;
            for (Entry entry : this.ˋ.entrySet()) {
                int intValue = ((Integer) entry.getKey()).intValue();
                AbstractSubstanceListItemCard abstractSubstanceListItemCard = (AbstractSubstanceListItemCard) entry.getValue();
                if (intValue == substanceListCardBean.ʼᐝ()) {
                    if (abstractSubstanceListItemCard.ˎ() == null) {
                        View inflate = ((ViewStub) this.ʻ.get(Integer.valueOf(intValue))).inflate();
                        abstractSubstanceListItemCard.ˎ(inflate);
                        abstractSubstanceListItemCard.ˏ(inflate);
                    }
                    abstractSubstanceListItemCard.ॱ(0);
                    abstractSubstanceListItemCard.ˏ(substanceListCardBean);
                } else {
                    abstractSubstanceListItemCard.ॱ(8);
                }
            }
        }
    }
}
